#include "SDL.h"
#include <vector>
#include <string>
#include "SDL_mixer.h"
#ifndef _AUDIO_H_
#define _AUDIO_H_

class cchunk
{
public:
       Mix_Chunk* mchunk; 
       bool playing;
       int ch;
};      

class sound: public std::vector<cchunk>
{
public:
	int setaudiomode(int,char,short);  //frequency,channels,chunksize  NOTE: Normal values are 44100,1,2,4096
	int loadaudio(char*);  //File can be .WAV, .MP3, .OGG, or .MID/.MIDI    
	int playaudio(short);
	int soundloop(short);
	void cleanupsound(void);
protected:
	std::string audiofile;
	int freq;
	char chan;
	short chunk;
	int channel;  //completely different from "chan" which refers to audio channels in terms of Stereo vs Mono
};
/*
Basically a copy of Nolan's code here, but optimized to work with a vector. Put this a .cpp if you actually use it of course.
void sound_system::addSound(char* input)
{
    push_back(Mix_LoadWAV(input));
    if(at(size()-1) == NULL)
    {
	    fprintf(stderr, "Cannot load sound file - Does the file exist?: %s\n", Mix_GetError());
        pop_back(); // the one big change: if the file is null, just clear away the latest element and return an error message.
    }
}
*/

#endif
